package com.erp.erp_dao.Cost;

import com.erp.erp_entitys.Cost.entity.CostDetailEntity;
import com.erp.erp_entitys.Cost.req.InsertPlanInStoreProductInfoReq;
import com.erp.erp_entitys.Cost.req.QueryCostDetailWarehouseReq;
import com.erp.erp_entitys.Cost.vo.CostDetailAndPlanInStoreProductInfo;
import com.erp.erp_entitys.Cost.vo.QueryCostDetailWarehouseVO;
import com.erp.erp_entitys.Cost.vo.QueryPlanInStoreProductInfoVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author zjk
 * @version 1.0
 * @description
 * @date 2020/11/24/024 19:25
 */
public interface CostDetailDao {
    /**
     * 根据费用主表编号删除费用明细
     * @param costCode  费用编号
     * @return  删除的记录数
     */
    int deleteByCostCode(String costCode);

    int insert(CostDetailEntity record);


    /**
     * 根据费用明细id获取信息
     * @param id
     * @return
     */
    CostDetailEntity selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(CostDetailEntity record);

    int updateByPrimaryKey(CostDetailEntity record);

    /**
     * 根据费用编号查询费用明细
     * @param costCode  费用编号
     * @return
     */
    List<CostDetailEntity> findAllByCode(String costCode);

    /**
     * 修改费用明细
     * @param costDetailEntity
     * @return  false:修改失败 true:修改成功
     */
    Boolean updateByCostDetailEntity(CostDetailEntity costDetailEntity);

    /**
     * 添加费用明细实体
     * @param record
     * @return
     */
    int insertSelective(CostDetailEntity record);

    /**
     * 添加费用明细集合
     * @param costDetailList
     * @return
     */
    int insertCostDetailList(@Param("costDetailList") List<CostDetailEntity> costDetailList);

    /**
     *根据费用明细id集合修改状态
     *
     * @param valid
     * @param ids
     * @return
     */
    Integer updateCostDetaiInvalid(@Param("valid") Integer valid, @Param("ids") List<Integer> ids);

    /**
     *根据费用明细id集合删除明细
     *
     * @param valid
     * @param ids
     * @return
     */
    Integer delCostDetaiInvalid(@Param("ids") List<Integer> ids);



    /**
     * 根据费用主编号修改费用明细状态为无效
     * @param costCode
     * @return
     */
    Integer updateCostDetaiByCostCode(String costCode);

    /**
     * 查询未分摊的费用明细，
     * @param req
     * @return
     */
    List<QueryCostDetailWarehouseVO> getUnShareCostDetails(QueryCostDetailWarehouseReq req);


    /**
     * 根据出运编码获取备货入库信息
     * @param invoiceCode
     * @return
     */
    List<QueryPlanInStoreProductInfoVo> getPlanInStoreInfo(String invoiceCode);

    /**
     * 根据出运编码,费用明细id 查询费用明细和备货入库产品信息
     * @param detailId
     * @param invoiceCode
     * @return
     */
    List<CostDetailAndPlanInStoreProductInfo> getCostDetailAndPlanInStoreProductInfo(@Param("detailId") Integer detailId, @Param("invoiceCode") String invoiceCode,@Param("share") Integer share);

}
